import 'package:flutter_test/flutter_test.dart';
import 'package:permission/permission.dart';
import 'package:permission/src/platform_interface/permission_platform_interface.dart';
import 'package:permission/src/method_channel/permission_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockPermissionPlatform
    with MockPlatformInterfaceMixin
    implements PermissionPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final PermissionPlatform initialPlatform = PermissionPlatform.instance;

  test('$MethodChannelPermission is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelPermission>());
  });

  test('getPlatformVersion', () async {
    Permission permissionPlugin = Permission();
    MockPermissionPlatform fakePlatform = MockPermissionPlatform();
    PermissionPlatform.instance = fakePlatform;

    expect(await permissionPlugin.getPlatformVersion(), '42');
  });
}
